<?php
// +----------------------------
// | Created by PhpStorm
// +----------------------------
// | Author: YnnSon
// +----------------------------
namespace app\api\model;

class InterfaceLog extends BaseModel
{
    /**
     * @Desc 获取接口日志
     *
     * @param $param
     *
     * @return array|bool|false|\PDOStatement|string|\think\Model
     */
    public static function getDetail($param)
    {
        return (new self)->where('code', '=', $param['code'])->where('date', '=', $param['date'])->find();
    }

    /**
     * @Desc 插入数据
     * @param $param
     *
     * @return InterfaceLog
     */
    public static function insertData($param)
    {
        return self::create($param);
    }

    /**
     * @Desc 添加使用次数
     * @param $param
     *
     * @return InterfaceLog
     */
    public static function addNum($param)
    {
        return (new self)->where('code', '=', $param['code'])->where('date', '=', $param['date'])->inc('num')->update();
    }
}